#include <iostream>
using namespace std;

class Date
{
public:
    Date(int year = 1, int month = 1, int day = 1)
        :_year(year)
        , _month(month)
        , _day(day)
    {
    }
    bool operator<(Date& d)
    {
        if (_year < d._year)
        {
            return true;
        }
        else if (_year == d._year && _month < d._month)
        {
            return true;
        }
        else if (_year == d._year && _month == d._month && _day < d._day)
        {
            return true;
        }
        return false;
    }

    bool operator==(Date& d)
    {
        return _year == d._year && _month == d._month && _day == d._day;
    }

    int GetMonthDays(int year, int month)
    {
        int a[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
        if (month == 2 && year % 4 == 0 && year % 100 != 0 || year % 400 == 0)
        {
            return 29;
        }
        return a[month];
    }

    Date& operator+=(int day)
    {
        _day += day;
        while (_day > GetMonthDays(_year, _month))
        {
            _day -= GetMonthDays(_year, _month);
            _month++;
            if (_month == 13)
            {
                _year++;
                _month = 1;
            }
        }
        return *this;
    }
    Date operator+(int day)
    {
        Date temp = *this;
        temp += day;
        return temp;
    }

    void Print()
    {
        printf("%4d-%02d-%02d", _year, _month, _day);
    }
private:
    int _year;
    int _month;
    int _day;
};

int main() {
    int year, month, day1, day2;
    cin >> year >> month >> day1 >> day2;
    Date temp(year, month, day1);
    temp += day2;
    temp.Print();

}